#include "includes.h"

static  OS_STK      App_TaskStartStk[APP_TASK_START_STK_SIZE];


static void App_TaskStart(void *p_arg);

int main()
{
	uint8_t os_err;
	
	OSInit();
	os_err = OSTaskCreate(App_TaskStart,
						  0,
						  &App_TaskStartStk[APP_TASK_START_STK_SIZE - 1],
						  APP_TASK_START_PRIO);
	OSTaskNameSet(APP_TASK_START_PRIO,  "Main_Task", &os_err);
	OSStart();
	return 0;
	
}

void App_TaskStart(void *p_arg)
{
	uint16_t cnt = 0;
	(void)p_arg;
	BSP_Init();
	OS_CPU_SysTickInit();
	
#if (OS_TASK_STAT_EN > 0)
    OSStatInit();                                               /* Determine CPU capacity.                              */
#endif
	
	printf("\r\nSystem Start...\r\n");
	printf("uCOSII Version: %d\r\n", OSVersion());
	printf("Author: iSww\r\n");

	while(1)
	{
		printf("Count: %d\r\n", cnt++);
		OSTimeDlyHMSM(0, 0, 1, 0);
	}
	
}

